#include <stdio.h>
#include "ofc/DLong.h"

int main(int argc, char *agv[])
{
  DLong *l1 = [DLong alloc];
  DLong *l2 = [DLong new  ];
  DText *str;

  [l1 init :-70];                      // Init with a number

  printf("Long1 has value:%ld.\n", [l1 get]); // Get value from object

  [l2 set :140];                       // Set with a number

  str = [l2 toText];
  printf("Long2 has value:%s as string.\n", [str cstring]); // Convert value to string
  [str free];

  if ([l1 compare :l2] == 0)           // Compare longs
    printf("Long1 and long2 are equal.\n");
  else if ([l1 compare :l2] < 0)
    printf("Long1 is smaller than long2.\n");
  else
    printf("Long1 is greater than long2.\n");

                                       // Conversion big- and little-endian
  printf("Long1 as little-endian (%ld) and as big-endian (%ld).\n", [l1 toLittleEndian], [l2 toBigEndian]);

  [l1 free];                           // Cleanup
  [l2 free];

  return 0;
}
